<?php
    include_once "config.php";
    include_once "db.php";
    
    //安全处理
    empty($debug)&&error_reporting(0);
    
    unset($_ENV,$HTTP_ENV_VARS,$_REQUEST,$HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_POST_FILES,$HTTP_COOKIE_VARS);
    
    extract(Add_S($_POST),EXTR_SKIP);
    extract(Add_S($_GET),EXTR_SKIP);
    
    $db=new DB($dbhost,$dbuser,$dbpass,$dbname);
    
    
    function Get_Cookie($nei)
    {
        return Add_s($_COOKIE[$nei]);
    }
    function Set_Cookie($name,$value,$time) 
    {
        setcookie($name,$value,$time);   
    }
    
    //=======安全处理
    
    //$nn模板名称，返回完整模板路径
    function T($nn)
    {
        global $template_path;
        
        return $template_path.$nn.".htm";
    }
    
    //html代码过滤
    function Add_S($array){
        foreach($array as $key=>$value){
            if(!is_array($value)){
                $array[$key]=addslashes($value);
            }else{
                Add_S($value);
            }
        }
        return $array;
    }
    


?>
